package com.twu.biblioteca;

import com.twu.biblioteca.actions.BibliotechaCommand;
import com.twu.biblioteca.actions.BibliotechaCommandFactoryImpl;
import com.twu.biblioteca.actions.BibliotechaCommandsFactory;
import com.twu.biblioteca.controller.LibraryController;
import com.twu.biblioteca.controller.LoginController;
import com.twu.biblioteca.domain.Book;
import com.twu.biblioteca.domain.Movie;

import java.util.HashMap;
import java.util.Map;


public class ActionPerformer {

    private final Map<String, BibliotechaCommand> actions;

    public ActionPerformer(BibliotechaCommandsFactory bibliotechaCommandFactory){
        actions = bibliotechaCommandFactory.getActions();
    }

    public boolean execute(String action, String parameter){

        if(actions.containsKey(action.toLowerCase())){
            actions.get(action.toLowerCase()).execute(parameter);
            return true;
        }
        return false;
    }

}
